1. Technical Field
The present invention relates to a pulse counting technique for measuring a physical quantity, such as a frequency, of an input signal having continuous pulse train by measuring a pulse interval of the input signal by counting pulses of a reference clock.
2. Related Art
A physical quantity, such as a frequency, of an input signal having continuous pulse train can be measured by detecting rising or falling edges of the input signal and measuring its interval by counting pulses of a reference clock whose frequency is known. Physical quantity measuring apparatus such as frequency measuring apparatus and pulse interval measuring apparatus which utilize this pulse counting technique are now in practical use.
In general, an input signal varies asynchronously with a reference clock. Therefore, in physical quantity measuring apparatus, an input signal is converted into a synchronized input signal which is synchronized with a reference clock and edge intervals of the synchronized input signal are measured by counting pulses of the reference clock.
FIG. 13 is a block diagram showing the configuration of a frequency measuring apparatus 400 in a related-art physical quantity measuring apparatus. As shown in FIG. 13, the frequency measuring apparatus 400 includes a synchronization circuit 410, a counting circuit 420, and a calculation circuit 430. The frequency measuring apparatus 400 receives an input signal fin and a reference clock CLK and measures a frequency of the input signal fin.
The synchronization circuit 410 generates, from the input signal fin, a synchronized input signal Fin which is synchronized with the reference clock CLK. FIG. 14 is a timing chart illustrating a relationship between the reference clock CLK, the input signal fin, and the synchronized input signal Fin. In this example, in referring to the temporal relationship between the signals, a relationship between their pulse rising edges is used. This also applies throughout the following description.
When the input signal fin rises with certain timing, the synchronization circuit 410 generates a pulse when the reference clock CLK rises for the first time thereafter. The synchronized input signal Fin is generated as shown in FIG. 14 by repeatedly performing this processing.
The counting circuit 420 counts the number of pulses of the reference clock CLK in a period when rising edges of the synchronized input signal Fin is counted a prescribed number of times. As a result, a cycle ratio between the reference clock CLK and the synchronized input signal Fin is obtained. Since the frequency of the reference clock CLK is known, a frequency of the synchronized input signal Fin is calculated by the calculation circuit 430.
Since the synchronized input signal Fin is generated by synchronizing the input signal fin with the reference clock CLK, the calculation circuit 430 uses the calculated frequency of the synchronized input signal Fin as the frequency of the input signal fin and outputs the former as a frequency measurement result of the input signal fin.
In the example of FIG. 14, the number of pulses of the reference clock CLK are counted while five rising edges of the synchronized input signal Fin are counted, that is, during four cycles of the synchronized input signal Fin. Thirteen the reference clock CLK are counted during cycles F1-F4 of the synchronized input signal Fin. This means that the cycle of the synchronized input signal Fin is 13/4 times that of the reference clock CLK. Therefore, if the frequency of the reference clock CLK is 100 MHz, the frequency of the synchronized input signal Fin is calculated as follows.100 MHz÷(13/4)=30.8 MHz.
The calculation circuit 430 outputs 30.8 MHz as a measurement result of the frequency of the input signal fin.
In general, to minimize a measurement error, the frequency measuring apparatus 400 performs plural measurements and outputs, as a measurement result, an average of measured values. In this case, if the next measurement is performed after completion of one measurement, a total measurement time becomes long and the real-time measurement cannot be performed. This problem can be solved, that is, the total measurement time can be shortened, by parallel counting with measurement period shifting.
However, where parallel counting is performed, k counters for counting the number of reference clocks are required to calculate an average of k measurement values, for example. Non-patent document 1 discloses a technique for avoiding such a complicated configuration. The number of measurements is set equal to the number n of cycles of a synchronized input signal Fin which is used for counting the number of reference clocks. With this measure, it is possible to count the number of pulses of the reference clock with a single counter. An average of n measurement values can be obtained through addition and subtraction operations.
As shown in FIG. 5, consideration will be given to a case of calculating a total number <N> of reference clocks in a period when (n+1) rising edges of a synchronized input signal Fin are counted, that is, counting operation in n cycles (called one unit) of the synchronized input signal Fin, is performed n times while the measurement period is shifted. It is assumed that each measurement period starts every time the synchronized input signal Fin rises. For example, the number n can be set equal to the number of rising edges of the synchronized input signal Fin in a prescribed reference time T.
Let Cc(i) represent the number of pulses of the reference clock CLK obtained in the i-th measurement. Then, an average <Nav> over n-times measurements is given by Equation (1):
                              〈                      N            av                    〉                =                              1            n                    ⁢                                    ∑                              i                =                1                            n                        ⁢                          Cc              ⁡                              (                i                )                                                                        (        1        )            Let Pk represent the number of pulses of the reference clock CLK at a time point when the k-th rising edge of the synchronized input signal Fin has occurred (its rising edge at the start of the measurement is the first rising edge). Then, relationships Cc(1)=Pn+1−P1, Cc(2)=Pn+2−P2, . . . , Cc(n)=P2n−Pn hold. P1 to Pn are the counted values of the reference clocks CLK during the first to n-th measurements, respectively. Pn−1 to P2n are counted values of the reference clocks CLK during the (n+1)-th to 2n-th measurements, respectively.
Equation (1) can be modified into Equation (2) using the Pk. In Equation (2), <Nsum> is a total number (ΣCc(i)) of pulses of the reference clock CLK in the n-times measurements.
                                                                        〈                                  N                  av                                〉                            =                            ⁢                                                1                  n                                ⁢                                                      ∑                                          i                      =                      1                                        n                                    ⁢                                      Cc                    ⁡                                          (                      i                      )                                                                                                                                              =                            ⁢                                                1                  n                                ⁢                                  {                                                            Cc                      ⁡                                              (                        1                        )                                                              +                                          Cc                      ⁡                                              (                        2                        )                                                              +                    …                    +                                          Cc                      ⁡                                              (                        n                        )                                                                              }                                                                                                                        =                                ⁢                                                                            1                      n                                        ⁢                                          {                                                                        P                                                      n                            +                            1                                                                          -                                                  P                          1                                                                    )                                                        +                                      (                                                                  P                                                  n                          +                          2                                                                    -                                              P                        2                                                              )                                    +                  …                  +                                      (                                                                  P                                                  2                          ⁢                          n                                                                    -                                              P                        n                                                              )                                                              }                                                                          =                            ⁢                                                1                  n                                ⁢                                  (                                                            -                                                                        ∑                                                      i                            =                            1                                                    n                                                ⁢                                                  P                          i                                                                                      +                                                                  ∑                                                  i                          =                                                      n                            +                            1                                                                                                    2                          ⁢                          n                                                                    ⁢                                              P                        i                                                                              )                                                                                                        =                            ⁢                                                1                  n                                ⁢                                  〈                                      N                    sum                                    〉                                                                                        (        2        )            
As seen from Equation (2), a total number <Nsum> of pulses of the reference clock CLK in the n-times measurements can be obtained by subtracting the sum of the count values P1 to Pn from the sum of the count values Pn+1 to P2n.
As described above, by setting the number of measurements equal to the number n of cycles of the synchronized input signal Fin, it becomes unnecessary to count the reference clock CLK for each of the n-times measurements and, instead, it is necessary for only one counter for counting the reference clock CLK from the start of the measurement.
Once the total number <Nsum> of pulses of the reference clock CLK that are counted in the n-times measurements each of which is performed in a period of n cycles of the synchronized input signal Fin is obtained, since an average <Nav> per measurement is given by <Nsum>/n, a frequency νFin is calculated according to Equation (3). In Equation (3), νCLK is the frequency of the reference clock CLK.
                                                                        v                Fin                            =                            ⁢                                                n                                      (                                                                  〈                                                  N                          sum                                                〉                                            n                                        )                                                  ⁢                                  v                                      C                    ⁢                                                                                  ⁢                    L                    ⁢                                                                                  ⁢                    K                                                                                                                          =                            ⁢                                                                    n                    2                                                                              -                                                                        ∑                                                      i                            =                            1                                                    n                                                ⁢                                                  P                          i                                                                                      -                                                                  ∑                                                  i                          =                                                      n                            +                            1                                                                                                    2                          ⁢                          n                                                                    ⁢                                              P                        i                                                                                            ⁢                                  v                                      C                    ⁢                                                                                  ⁢                    L                    ⁢                                                                                  ⁢                    K                                                                                                          (        3        )                [Patent document 1] JP-A-2004-198393    [Non-patent document 1] J. J. Snyder, “An Ultra-high Resolution Frequency Meter,” Proc. 35th Ann. Freq. Control Symposium, USAERADCOM, Ft. Monmouth, N.J., 07703, May 1981.
As described above, by setting the number of measurements equal to the number of cycles of the synchronized input signal Fin, it become sufficient to use only one counter for counting the number of pulses of the reference clock and an average of the ratio between the cycle of the reference clock CLK and that of the synchronized input signal Fin can be obtained through addition and subtraction operations.
However, since the synchronized input signal Fin is generated by synchronizing the input signal fin with the reference clock CLK, as shown in FIG. 16 corresponding rising edges of the input signal fin and the synchronized input signal Fin are deviated from each other by a value that is smaller than the cycle of the reference clock CLK.
More specifically, a one-unit measurement length of the synchronized input signal Fin which is used for counting and the length of a corresponding part of the input signal fin (real length) has a deviation that depends on a front deviation and a rear deviation. Whereas the front deviation and the rear deviation are such quantities as to make the one-unit measurement length of the synchronized input signal Fin shorter and longer than the length of the corresponding part of the input signal fin (real length), respectively, the difference between the front deviation and the rear deviation results in an error.
Since an error included in the conversion from an input signal into a synchronized input signal finally appears as an error of a measurement result frequency, it is desirable that the conversion error be as small as possible. One method for decreasing the conversion error is to set the frequency of a reference clock higher. However, this is not preferable because it increases the power consumption. Furthermore, the frequency of a reference clock cannot be increased easily because it has a certain upper limit due to other restrictions.